import { Request, Response } from 'express';

const menuList = [
  {
    path: '/user',
    routes: [
      { path: '/user', routes: [{ name: '登录', path: '/user/login', component: './user/Login' }] },
      { component: './404' },
    ],
  },
  { path: '/welcome', name: '欢迎', icon: 'smile', component: './Welcome' },
  {
    path: '/admin',
    name: '管理页',
    icon: 'crown',
    access: 'canAdmin',
    component: './Admin',
    routes: [
      { path: '/admin/sub-page', name: '二级管理页', icon: 'smile', component: './Welcome' },
      { component: './404' },
    ],
  },
  { name: '查询表格', icon: 'table', path: '/list', component: './TableList' },
  {
    path: '/system',
    name: '系统管理',
    icon: 'crown',
    routes: [
      { path: '/system', redirect: '/system/user' },
      { path: 'menu', name: '菜单管理', icon: 'smile', component: './system/menu' },
      { path: 'role', name: '角色管理', icon: 'smile', component: './system/role' },
      { path: 'user', name: '用户管理', icon: 'smile', component: './system/user' },
      { component: './404' },
    ],
  },
  { path: '/', redirect: '/welcome' },
  { component: './404' },
];

export default {
  'POST  /api/menus': (req: Request, res: Response) => {
    res.send({
      data: menuList,
      success: true,
    });
  },
};
